 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TabView Example - Adding Transition Effects</title>
<link rel="stylesheet" type="text/css" href="css/example.css">

<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/tabview.css">
<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/border_tabs.css">
<script type="text/javascript" src="../../build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../build/event/event.js"></script>
<script type="text/javascript" src="../../build/dom/dom.js"></script>
<script type="text/javascript" src="../../build/connection/connection.js"></script>
<script type="text/javascript" src="../../build/animation/animation.js"></script>
<script type="text/javascript" src="../../build/element/element-beta.js"></script>
<script type="text/javascript" src="../../build/tabview/tabview.js"></script>

<style type="text/css">
#demo { width:30em; }

#demo .yui-content {
    border:1px solid #000;
    height:4em;
    padding:0 1em;
}

#demo .yui-content div {
    background-color:#f6f7ee; /* for IE double text bug */
    position:absolute; /* to overlap during transition */
}


</style>
<script type="text/javascript">
YAHOO.example.init = function() {
    var myTabs = new YAHOO.widget.TabView('demo');
    myTabs.contentTransition = function(newTab, oldTab) {
        if ( newTab.anim && newTab.anim.isAnimated() ) {
            newTab.anim.stop(true);
        }
        
        newTab.set('contentVisible', true);
        YAHOO.util.Dom.setStyle(newTab.get('contentEl'), 'opacity', 0);
        
        newTab.anim = newTab.anim || new YAHOO.util.Anim( newTab.get('contentEl') );
        newTab.anim.attributes.opacity = { to: 1 };
        
        var hideContent = function() {
            oldTab.set('contentVisible', false);
            oldTab.anim.onComplete.unsubscribe(hideContent);
        };
        
        oldTab.anim = oldTab.anim || new YAHOO.util.Anim( oldTab.get('contentEl') );
        oldTab.anim.onComplete.subscribe(hideContent, this, true);
        oldTab.anim.attributes.opacity = { to: 0 };
        
        newTab.anim.animate();
        oldTab.anim.animate();
    };

};

YAHOO.example.init();
</script>

</head>
<body>
<div id="doc">
    <h1>TabView Example - Adding Transition Effects</h1>
    <p>This example demonstrates how to add transition effects.</p>

    <div id="demo" class="yui-navset">
        <ul class="yui-nav">
            <li class="selected"><a href="#lorem"><em>lorem</em></a></li>
            <li><a href="#ipsum"><em>ipsum</em></a></li>
            <li><a href="#dolor"><em>dolor</em></a></li>
        </ul>
        <div class="yui-content">
            <div>
                <p>Lorem</p>
            </div>
            <div>
                <p>Ipsum</p>
            </div>
            <div>
                <p>Dolor</p>
            </div>
        </div>
    </div>
</div>
</body>
</html>
